package com.ql.reflect;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.Properties;

public class LoadProperties {
	public static void main(String[] args){
		try {
			//InputStream ips=new FileInputStream("src/com/enhance/reflect/config.properties");//src/com/enhance/reflect/config.properties
			
//			InputStream ips=LoadProperties.class.getClassLoader().getResourceAsStream("com/enhance/reflect/config.properties");
			//InputStream ips=LoadProperties.class.getResourceAsStream("config.properties");
			InputStream ips=LoadProperties.class.getResourceAsStream("resource/config.properties");
			
			Properties props=new Properties();
			props.load(ips);
			ips.close();
			String classname=props.getProperty("classname");
			Collection collections=(Collection)Class.forName(classname).newInstance();
			
			ReflectPoint pt1=new ReflectPoint(3,3);
			ReflectPoint pt2=new ReflectPoint(4,3);
			ReflectPoint pt3=new ReflectPoint(3,3);
			collections.add(pt1);
			collections.add(pt2);
			collections.add(pt3);
			
			System.out.println(collections.size());
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
	}
}
